import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import axios from "axios";
import iView from "iview";
import "iview/dist/styles/iview.css";
import localStorage from "./util/LocalStorage";
import "./common/common.css";
import service from "./util/service";
import VueClipboard from "vue-clipboard2";
import highcharts from 'highcharts'
import moment from 'moment'
import 'moment/locale/zh-cn'


Vue.use(VueClipboard);

Vue.config.productionTip = false;

Vue.use(iView, {
  transfer: false,
  size: "large"
});
moment.locale('zh-cn');

Vue.prototype.$highcharts = highcharts

Vue.prototype.$localStorage = localStorage;
Vue.prototype.$axios = axios;
Vue.prototype.$service = service;
Vue.prototype.$moment = moment


router.beforeEach((to, from, next) => {
  if (to.path == "/") {
    if (localStorage.storageGet("TOKEN")) {
      router.push({
        name: "Home"
      });
    } else {
      next();
    }
  } else {
    next();
  }
});

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount("#app");